
import pyclipper
import numpy as np

# 原始多边形
polygon = [(100, 100), (200, 100), (200, 200), (100, 200)]

# 创建偏移对象
pco = pyclipper.PyclipperOffset()

# 添加路径并设置参数
pco.AddPath(polygon, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)

# 执行偏移操作（正数外扩，负数内缩）
offset_distance = 10
offset_polygon = pco.Execute(offset_distance)[0]

print("原始多边形:", polygon)
print("偏移后多边形:", offset_polygon)
